package tech.xs.sys.domain.bo.dict;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import tech.xs.common.framework.domain.bo.PageBo;
import tech.xs.common.framework.domain.entity.BaseEntity;
import tech.xs.sys.domain.entity.SysDict;

/**
 * @author 沈家文
 * @since 2023/5/30 19:52
 */
@Getter
@Setter
@ToString
public class PageDictBo extends PageBo<SysDict> {

    private String likeCode;

    private String likeName;

    public LambdaQueryWrapper<SysDict> query() {
        return Wrappers.<SysDict>lambdaQuery()
                .like(StrUtil.isNotBlank(likeCode), SysDict::getCode, likeCode)
                .like(StrUtil.isNotBlank(likeName), SysDict::getName, likeName)
                .orderByDesc(BaseEntity::getCreatedTime);
    }
}
